package com.phy.gsjl.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 
 * @author curry 信息实体类
 */
@Entity
@Table(name = "message")
public class Message implements Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 信息ID,主键
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "m_id", nullable = false, unique = true)
	private Integer m_id;

	/**
	 * 信息类型：留言信息-->1，报修信息-->2，投诉信息-->3
	 */
	@Column(name = "type", nullable = false)
	private Integer type;

	/**
	 * 发布序号
	 */
	@Column(name = "m_number", nullable = false)
	private String m_number;

	/**
	 * 信息发布时间
	 */
	@Column(name = "m_time", nullable = false)
	private Timestamp m_time;

	/**
	 * 发布人
	 */
	@Column(name = "username", nullable = false)
	private String username;

	/**
	 * 信息内容
	 */
	@Column(name = "m_details", nullable = false, length=1024)
	private String m_details;

	/**
	 * 信息状态，新建-->0、已回复-->1
	 */
	@Column(name = "status", nullable = false)
	private Integer status;

	public Message() {

	}

	public Message(Integer type, String username, String m_details) {
		this.type = type;
		this.m_time = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		this.username = username;
		this.m_details = m_details;
		this.status = 0;
	}

	public Integer getM_id() {
		return m_id;
	}

	public void setM_id(Integer m_id) {
		this.m_id = m_id;
	}

	public String getM_number() {
		return m_number;
	}

	public void setM_number(String m_number) {
		this.m_number = m_number;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Timestamp getM_time() {
		return m_time;
	}

	public void setM_time(Timestamp m_time) {
		this.m_time = m_time;
	}

	public String getM_details() {
		return m_details;
	}

	public void setM_details(String m_details) {
		this.m_details = m_details;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Override
	public String toString() {
		return "Message [m_id=" + m_id + ", type=" + type + ", m_number=" + m_number + ", m_time=" + m_time
				+ ", username=" + username + ", m_details=" + m_details + ", status=" + status + "]";
	}

}
